home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / gnu / fpu881 / src6.zoo / _addsubd.s next >
Text File  |  1991-09-24  |  2KB  |  68 lines

  1. # double precision floating point stuff for Atari-gcc using the SFP004
  2. # developed with gas
  3. #
  4. # double floating point add/subtract routine
  5. #
  6. # M. Ritzert (mjr at dmzrzu71)
  7. #
  8. # 4.10.1990
  9. #
  10. # no NAN checking implemented since the 68881 treats this situation "correct",
  11. # i.e. according to IEEE
  12.  
  13. # addresses of the 68881 data port. This choice is fastest when much data is
  14. # transferred between the two processors.
  15.  
  16. comm =     -6
  17. resp =    -16
  18. zahl =      0
  19.  
  20. # waiting loop ...
  21. #
  22. # wait:
  23. # ww:    cmpiw    #0x8900,a0@(resp)
  24. #     beq    ww
  25. # is coded directly by
  26. #    .long    0x0c688900, 0xfff067f8
  27.  
  28.     .text
  29.     .even
  30.     .globl    __subdf3, ___subdf3
  31.     .globl    __adddf3, ___adddf3
  32.  
  33. __subdf3:
  34. ___subdf3:
  35. # double precision subtraction
  36. # sub second arg from fp0
  37.     lea    0xfffa50,a0
  38.     movew    #0x5400,a0@(comm)    | load first argument to fp0
  39.     cmpiw    #0x8900,a0@(resp)    | check
  40.     movel    a7@(4),a0@
  41.     movel    a7@(8),a0@
  42.     movew    #0x5428,a0@(comm)
  43.     .long    0x0c688900, 0xfff067f8
  44.     movel    a7@(12),a0@
  45.     movel    a7@(16),a0@
  46.     movew    #0x7400,a0@(comm)    | result to d0/d1
  47.     .long    0x0c688900, 0xfff067f8
  48.     movel    a0@,d0
  49.     movel    a0@,d1
  50.      rts
  51.  
  52. __adddf3:
  53. ___adddf3:
  54.     lea    0xfffa50,a0
  55.     movew    #0x5400,a0@(comm)        | load fp0
  56.     cmpiw    #0x8900,a0@(resp)        | got it?
  57.     movel    a7@(4),a0@            | take a hi from stack to FPU
  58.     movel    a7@(8),a0@            | take a lo from stack to FPU
  59.     movew    #0x5422,a0@(comm)        | add second arg to fp0
  60.     .long    0x0c688900, 0xfff067f8
  61.     movel    a7@(12),a0@            | move b hi from stack to FPU
  62.     movel    a7@(16),a0@            | move b lo from stack to FPU
  63.     movew    #0x7400,a0@(comm)        | result to d0/d1
  64.     .long    0x0c688900, 0xfff067f8
  65.     movel    a0@,d0                | download result
  66.     movel    a0@,d1                | download result
  67.      rts
  68.